import { handleRequest } from './index';
import request from '@/utils/request'
import { safetyApiUrl, commonApiUrl, appApiUrl } from '@/api/config.js'
import request2 from '@/utils/request2'
// 获取-验收计划列表
export function getAcceptancePlanList(data) {
    return handleRequest({
        url: '/month-safe/accept-plan/list',
        method: 'post',
        data
    })
}
// 获取-验收计划列表
export function acceptancePlanImport(data) {
    return request2({
        url: safetyApiUrl+'/month-safe/accept-plan/import',
        method: 'post',
        data
    })
}
// 获取-危大工程验收计划列表
export function dangerList(data) {
    return handleRequest({
        url: '/month-safe/accept-plan/dangerList',
        method: 'post',
        data
    })
}
// 获取-验收计划统计
export function getAcceptancePlanCount(data) {
    return handleRequest({
        url: '/month-safe/count-plan',
        method: 'post',
        data
    })
}

// 获取危大工程验收计划列表--顶部统计
export function dangerListCount(data) {
    return handleRequest({
        url: '/month-safe/accept-plan/dangerListCount',
        method: 'post',
        data
    })
}

// 获取
export function detail(params) {
    return request2({
        url: safetyApiUrl + '/month-safe/record/query/' + params.id,
        method: 'get',
        params
    })
}
// 获取-验收记录列表
export function getAcceptanceRecordList(data) {
    return handleRequest({
        url: '/month-safe/record/query',
        method: 'post',
        data
    })
}

export function del(params) {
    return request2({
        url: safetyApiUrl+'/month-safe/record/del',
        method: 'post',
        params
    })
}

// 获取-验收记录统计
export function getAcceptanceRecordCount(data) {
    return handleRequest({
        url: '/month-safe/count-record',
        method: 'post',
        data
    })
}


// 查看-验收计划详情
export function getAcceptancePlanDetail(params) {
    return handleRequest({
        url: '/month-safe/accept-plan',
        method: 'get',
        params
    })
}

// 新增-验收计划
export function addAcceptancePlan(data) {
    return handleRequest({
        url: '/month-safe/accept-plan',
        method: 'post',
        data
    })
}

// 修改-验收计划
export function updateAcceptancePlan(data) {
    return handleRequest({
        url: '/month-safe/accept-plan/update',
        method: 'post',
        data
    })
}

// 删除-验收计划
export function deleteAcceptancePlan(params) {
    return handleRequest({
        url: '/month-safe/accept-plan/del',
        method: 'post',
        params
    })
}

// 利用验收表类型ID查看安全验收记录模板
export function getAcceptanceRecord(params) {
    return request({
        url: safetyApiUrl+'/month-safe/type/query',
        method: 'get',
        params
    })
}

// 新增基础信息字段设置
export function addDetail(data) {
    return handleRequest({
        url: '/month-safe/detail',
        method: 'post',
        data
    })
}
// 修改基础信息字段设置
export function editDetail(data) {
    return handleRequest({
        url: '/month-safe/detail/update',
        method: 'post',
        data
    })
}
// 删除-基础信息字段设置
export function delDetail(data) {
    return handleRequest({
        url: '/month-safe/detail/del',
        method: 'post',
        data
    })
}

// 新增增检查项目
export function addTree(data) {
    return request({
        url: safetyApiUrl+'/month-safe/detail/tree',
        method: 'post',
        data
    })
}
// 修改增检查项目
export function editTree(data) {
    return request({
        url: safetyApiUrl+'/month-safe/detail/tree/update',
        method: 'post',
        data
    })
}
// 删除-增检查项目
export function delTree(data) {
    return handleRequest({
        url: '/month-safe/detail/tree/del',
        method: 'post',
        data
    })
}

// 停用启用增检查项目
export function onOffTree(data) {
    return request({
        url:safetyApiUrl+ '/month-safe/detail/tree/status',
        method: 'post',
        data
    })
}

/**
 * 安全验收记录打印内容获取
 * @param {Object} params  { id: xxxx }
 */
export function getPrintContent(params) {
  return request({
    url: safetyApiUrl + '/month-safe/record/print/' + params.id + '/' + params.index,
    method: 'get'
  })
}

